package com.hlg.xboot.model;

import org.apache.commons.collections.map.HashedMap;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import java.util.Map;

/**
 * <p>Description: 字典表基本类型</p>
 * <p>Copyright: Copyright (c) 2017</p>
 * <p>Company: 智悦信息</p>
 * <p>Site: www.zhiyuesoft.com</p>
 * @author TZW
 * @version 1.0
 * @date 2017/07/31
 */
@MappedSuperclass
public class BaseDic extends AbstractModel {

    @Column(name = "code")
    public String code;

    @Column(name = "name")
    public String name;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Map<String, Object> transformMapModel(){
        Map<String, Object> data = new HashedMap();
        data.put("code", getCode());
        data.put("name", getName());
        return data;
    }

    public Map<String, Object> transformTreeModel(){
        Map<String, Object> data = new HashedMap();
        data.put("value", getCode());
        data.put("label", getName());
        return data;
    }
}
